package com.yami.shop.delivery.api.controller;


import com.yami.shop.common.response.ServerResponseEntity;
import com.yami.shop.delivery.common.model.OrderSelfStation;
import com.yami.shop.delivery.common.service.OrderSelfStationService;
import com.yami.shop.security.api.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Lanhai
 */
@RestController
@RequestMapping("/p/orderSelfStation")
@Tag(name = "用户自提订单信息接口")
public class OrderSelfStationController {

    @Autowired
    private OrderSelfStationService orderSelfStationService;

    @GetMapping("/getStationUserInfo")
    @Operation(summary =  "获取常用提货人信息", description = "用户创建订单时，获取常用提货人信息")
    public ServerResponseEntity<List<OrderSelfStation>> getStationUserInfo() {
        String userId = SecurityUtils.getUser().getUserId();
        List<OrderSelfStation> orderSelfStationList = orderSelfStationService.getStationUserInfo(userId);
        return ServerResponseEntity.success(orderSelfStationList);
    }
}
